package com.cloudfun.campusshare.repo;

import com.cloudfun.campusshare.configuration.jpa.GaodaoRepository;
import com.cloudfun.campusshare.entity.OrderRefundEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;

public interface OrderRefundEntityRepo extends GaodaoRepository<OrderRefundEntity, Integer> {
    @Query(value = "select * from order_refund where  order_no=?1 and refund_review='PENDING_REVIEW' or refund_review='SUCCESS' ",nativeQuery = true)
    OrderRefundEntity findByOrderNoAndRefundReview(String orderNo);


    OrderRefundEntity findByOrderRefundNo(String orderRefundNo);

    @Query(value = "select pay_platform,merchant_id,SUM(price) from order_refund WHERE  refund_review='PENDING_REVIEW'  GROUP BY pay_platform,merchant_id",nativeQuery = true)
    OrderRefundEntity findBy(String orderRefundNo);

}
